|
|
|
|
|
|
|
Using a Container Control |
|
|
|
|
|
|
|
|
To use the TabStrip control, you need to place several containers on it. You can then place controls on top of the containers. Its up to you to manipulate the appropriate container when the corresponding tab is clicked. For example, if you have three tabs, you need three container controls. When you click the first tab, you need to make the first container control visible and the other two containers invisible. A good container control to use is the frame control, because you can specify whether to use a border, and it has a little less overhead than a picture control. |
|
|
|
|
|
|
|
|
When you create the container controls, make sure to place them in a control array and set the Index property of each container to 1 through the number of tabs you have on the TabStrip control. Also, make sure you use each container so that it corresponds to the number of the tab. For example, in the example, I created the fraEmp(1) control to be the one that holds the controls for the first tab. The second frame, fraEmp(2), houses the controls for the second tab, and so on. |
|
|
|
|
|
|
|
|
You should make sure that all the container controls are lined up at runtime. In this example, you use three frame controls as containers. In the Form_Load() procedure, you first make all the frames invisible, except for the first one you want to display. Next, you need to line up all the frames to the same location by using the ClientLeft, ClientTop, ClientWidth, and ClientHeight properties of the TabStrip control. These properties are automatically set by the control for just the purpose of positioning the container controls: |
|
|
|
 |
|
|
|
|
Private Sub Form_Load()
' Start with 1st Frame Visible
fraEmp(1).Visible = True
fraEmp(2).Visible = False
fraEmp(3).Visible = False
With tabEmployee
fraEmp(1).Move .ClientLeft, .ClientTop, _
.ClientWidth, .ClientHeight
fraEmp(2).Move .ClientLeft, .ClientTop, _
.ClientWidth, .ClientHeight
fraEmp(3).Move .ClientLeft, .ClientTop, _
.ClientWidth, .ClientHeight
End With
End Sub |
|
|
|
|
|